# -*- coding:utf8 -*- #

# -----------------------------------------------------------------------------------

# ProjectName:   property-ui-auto-test

# FileName:     get_log

# Author:

# Datetime:    2022/9/23 14:08

# Description：

# -----------------------------------------------------------------------------------
import os
from loguru import logger

from common.util.confUtil.configUtil import Config
from common.util.timeUtil.timeUtil import get_now_time


class Logger:
    def __init__(self):
        log_path = Config().get_log_path()
        name = os.path.join(log_path, f"Test-{get_now_time(3)}.log")
        logger.remove(handler_id=None)
        logger.add(name, retention="7 days", rotation="50MB", enqueue=True, encoding='utf-8', compression="zip")

    @staticmethod
    def info(msg):
        """打印 info 级别的日志"""
        logger.info(msg)

    @staticmethod
    def debug(msg):
        """打印 debug 级别的日志"""
        logger.debug(msg)

    @staticmethod
    def warning(msg):
        """打印 warning 级别的日志"""
        logger.warning(msg)

    @staticmethod
    def error(msg):
        """打印 error 级别的日志"""
        logger.error(msg)


if __name__ == '__main__':
    pass
